<include file="./Tpl/Public/header.html" />
<h1>
    <span class="action-span1">{$current_operation[g][title]}->{$current_operation[m][title]}->{$current_operation[a][title]}</span>
    <foreach name="list_main_menu" item="info">
    <span class="action-span"><a href="{$info[url]}" target="{$info[target]}">{$info[title]}</a></span>
    </foreach>
    <div style="clear:both"></div>
</h1>

<div class="list-div">
<table cellspacing='1' cellpadding='3'>
  <tr>
    <th>序号</th>
    <th><a href="?_order=out_number&_sort={$sort}">出单单号</a><if condition="$order eq 'out_number'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th><th><a href="?_order=total_amount&_sort={$sort}">合计总金额</a><if condition="$order eq 'total_amount'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th>
    <th>销售日期</th>
    <th>客户</th>
    <th><a href="?_order=salesman_id&_sort={$sort}">销售员</a><if condition="$order eq 'salesman_id'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th><th><a href="?_order=auditor_id&_sort={$sort}">审核人</a><if condition="$order eq 'auditor_id'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th><th><a href="?_order=audit_date&_sort={$sort}">审核时间</a><if condition="$order eq 'audit_date'"><img src="__PUBLIC__/images/{$sortImg}.gif" width="9px" height="9px" alt="{$sortAlt}" /></if></th>
    <th>操作</th>
    </tr>
  <foreach name="list" item="info" key="k">
  <php>if($i++%2==0){ $class='even'; }else{ $class='odd'; }</php>
  <tr class="{$class}">
	<td>{$k+1}</td>
    <td>{$info[out_number]}</td><td>{$info[total_amount]}</td>
    <td>{$info[sale_date]}</td>
    <td>{$info[customer_name]}</td>
    <td>{$info[salesman_name]}</td>
    <td>{$info[auditor_name]}</td><td>{$info[audit_date]}</td>
    <td>
      <a href='{:U("sales_show?id=$info[id]")}'>明细</a> | 
      <a href='{:U("audit?id=$info[id]")}'>审核</a> | 
      <a href="javascript:confirm_delete('{$info[id]}');">删除</a>
    </td>
    </tr>
  </foreach>
</table>
<div id="turn-page">{$page}</div>
</div>
<div id="dialog_add"><!--添加信息 --></div>
<div id="dialog_edit"><!-- 修改信息--></div>
<div id="dialog_delete" style="color:#F00; font-size:13px; vertical-align: middle;">"彻底删除"的数据是不可恢复的，请慎用！</div>
<script type="text/javascript">
$("#dialog_add").dialog({
    autoOpen: false,
    title: '添加信息',
    width:'800',
    height:'600',
    modal: true,
    buttons: {
        '确认': function () {
   			$("#dialog_add form").submit();
   		},
        '取消': function () {
           $("#dialog_add").dialog("close");
        }
    }
});
function dialog_add(){
	var uri='{:U("sales_add")}';
	$.ajax({
		type: "get",
		url: uri,
		dataType:"html",
		success: function(html){
			$("#dialog_add").html(html);
			$("#dialog_add").dialog("open");
		}
	});
}
$("#dialog_edit").dialog({
    autoOpen: false,
    title: '修改信息',
    width:'600',
    height:'400',
    modal: true,
    buttons: {
        '确认': function () {
   			$("#dialog_edit form").submit();
   		},
        '取消': function () {
           $("#dialog_edit").dialog("close");
        }
    }
});
function dialog_edit(id){
	var uri='{:U("sales_edit?id=")}'+id;
	$.ajax({
		type: "get",
		url: uri,
		dataType:"html",
		success: function(html){
			$("#dialog_edit").html(html);
			$("#dialog_edit").dialog("open");
		}
	});
}
//删除数据
var delete_id="";
$("#dialog_delete").dialog({
    autoOpen: false,
    title: '删除信息',
    width:'270',
    height:'150',
    modal: true,
    buttons: {
        '丢到垃圾站': function () {
        	window.location.href='{:U("delete?id=")}'+delete_id;
   		},
        '彻底删除': function () {
			window.location.href='{:U("foreverdelete?id=")}'+delete_id;
        },
		'取消': function () {
           $("#dialog_delete").dialog("close");
        }
    }
});
function confirm_delete(id){
	delete_id=id;
	$("#dialog_delete").dialog("open");
}
</script>
<include file="./Tpl/Public/footer.html" />